package ${package}.${moduleName}.controller;

import cn.com.pg.instore.core.config.annotation.MultiScenarioService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import cn.com.pg.instore.core.common.dto.PageDto;
import cn.com.pg.instore.core.config.PgResponse;
import ${package}.${moduleName}.service.${ClassName}Service;
import ${package}.${moduleName}.query.${ClassName}Query;
import ${package}.${moduleName}.service.api.dto.${ClassName}Dto;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* <p>
* ${tableComment}
* </p>
* @author ${author}
* @since ${date}
*/
@RestController
@RequestMapping("/api/v1/${functionName}")
@Tag(name="${tableComment}")
@RequiredArgsConstructor
public class ${ClassName}Controller {
    @MultiScenarioService
    private final ${ClassName}Service ${className}Service;

    @GetMapping("page")
    @Operation(summary = "分页")
    @PgResponse
    public PageDto<${ClassName}Dto> page(@SpringQueryMap ${ClassName}Query query){
        return  ${className}Service.page(query);
    }

    @GetMapping("{id}")
    @Operation(summary = "信息")
    @PgResponse
    public ${ClassName}Dto get${ClassName}ById(@PathVariable("id") String id){
        return ${className}Service.get${ClassName}ById(id);
    }

    @PostMapping
    @Operation(summary = "保存")
    @PgResponse
    public Boolean save(@RequestBody ${ClassName}Dto dto){
        return  ${className}Service.save${ClassName}(dto);
    }

    @PutMapping
    @Operation(summary = "修改")
    @PgResponse
    public Boolean update(@RequestBody @Valid ${ClassName}Dto dto){
        return ${className}Service.update${ClassName}(dto);
    }

    @DeleteMapping
    @Operation(summary = "删除")
    @PgResponse
    public Boolean deleteByIds(@RequestBody List<String> idList){
        return ${className}Service.deleteByIds(idList);
    }
}